<template>
	<view class="checkbox-box" :class="ggclass" :style="{width:$rpxunit(size),height:$rpxunit(size)}">
		<view class="checkbox" @click="isPitch=!isPitch" :style="{background:isPitch?colors:''}" :class="{pitch:isPitch}">
		</view>
	</view>
</template>

<script>
	import propsMixin from '../mixins/props/index.js'
	export default {
		mixins:[propsMixin],
		props: {
			value: {
				type: Boolean,
				default: false
			},
			size:{
				type:[String,Number],
				default:'',
			}
		},
		data(){
			return {
			}
		},
		computed: {
			isPitch: {
				get() {
					return this.value 
				},
				set(val) {
					this.$emit('input', val)
					this.$emit('change',val)
				}
			},
			colors(){
				return this.color || this.$color.main
			}
		},
		methods: {

		}
	}
</script>

<style lang="scss" scoped>
	.checkbox-box {
		display: flex;
		align-items: center;
		font-size: 24rpx;
		.checkbox {
			width: 100%;
			height: 100%;
			border-radius: 50%;
			border: 1rpx solid #999;
		}
	}

	.pitch {
		border: none !important;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		height: 100%;
		&::before {
			content: '';
			display: inline-block;
			margin-top: calc(-100% * 0.1);
			width: calc(100% * 0.4);
			height: calc(100% * 0.2);
			border-left: 4rpx solid #fff;
			border-bottom: 4rpx solid #fff;
			transform: rotate(-45deg);
		}
	}
</style>